package com.example.springboot.controller;

import com.example.springboot.common.Result;
import com.example.springboot.pojo.dto.LoginDTO;
import com.example.springboot.service.IUserService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class WebController {

    @Resource
    private IUserService userService;




    @GetMapping("/")
    public Result hello() {
        return Result.success("success");
    }

    @PostMapping("/login")
    public Result login(@RequestBody LoginDTO loginDTO) {
        return userService.login(loginDTO);
    }


    @GetMapping("/logout/{id}")
    public Result logout(@PathVariable String id) {
        return userService.logout(id);
    }

}
